#include <string>
#include <iostream> //USED FOR DEBUGING
#include "Command.h"
#include "Environment.h"
#include <list>
#include <vector>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

class Parser{
    public:
        Parser(Environment *e);
        int parseInput(const char* in);
        char*** getArgList();
        std::list<Command> getCmdList();
        int getCommandCode() { return commandCode;}
        Command getCommandAt(int index);
        bool isBackgroundProcess() { return backGroundProcess;}
        void reset();

        //Getting stream paths if present
        std::string getSTDIN(){ return _stdIN;}
        std::string getSTDOUT(){ return _stdOUT;}
        std::string getSTDERR(){ return _stdERR;}

        std::vector<char> getConditionals() {return conditionals;}

        typedef enum {NOOUTPUT, COMMAND, CONDITIONAL};

    private:
        void processCommand(std::string command);
        void removeWhitespace(std::string* str);

        std::list<Command> commandList;
        std::string _stdIN;
        std::string _stdOUT;
        std::string _stdERR;
        int commandCode;
        bool backGroundProcess;
        Environment *enviro;

        std::vector<char> conditionals;

};


